<?php

namespace App\Http\Middleware;

use App\Framework\Session\ManagerSession;
use Closure;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\URL;

class ManagerAuth
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if (ManagerSession::isLogined() == false) {
            return redirect(URL::action('AdminController@login'));
        }

        return $next($request);
    }
}
